home *** CD-ROM | disk | FTP | other *** search
/ AmigActive 22 / AACD 22.iso / AACD / Online / Apache / include / php / ext / standard / fsock.h < prev    next >
Encoding:
C/C++ Source or Header  |  2000-07-23  |  3.3 KB  |  113 lines

  1. /*
  2.    +----------------------------------------------------------------------+
  3.    | PHP version 4.0                                                      |
  4.    +----------------------------------------------------------------------+
  5.    | Copyright (c) 1997, 1998, 1999, 2000 The PHP Group                   |
  6.    +----------------------------------------------------------------------+
  7.    | This source file is subject to version 2.02 of the PHP license,      |
  8.    | that is bundled with this package in the file LICENSE, and is        |
  9.    | available at through the world-wide-web at                           |
  10.    | http://www.php.net/license/2_02.txt.                                 |
  11.    | If you did not receive a copy of the PHP license and are unable to   |
  12.    | obtain it through the world-wide-web, please send a note to          |
  13.    | license@php.net so we can mail you a copy immediately.               |
  14.    +----------------------------------------------------------------------+
  15.    | Authors: Paul Panotzki - Bunyip Information Systems                  |
  16.    |          Jim Winstead (jimw@php.net)                                 |
  17.    +----------------------------------------------------------------------+
  18. */
  19.  
  20. /* $Id: fsock.h,v 1.29 2000/07/24 01:39:49 david Exp $ */
  21.  
  22. /* Synced with php 3.0 revision 1.24 1999-06-18 [ssb] */
  23.  
  24. #ifndef FSOCK_H
  25. #define FSOCK_H
  26.  
  27. #ifdef PHP_WIN32
  28. # ifndef WINNT
  29. #  define WINNT 1
  30. # endif
  31. # undef FD_SETSIZE
  32. # include "arpa/inet.h"
  33. # define socklen_t unsigned int
  34. #endif
  35.  
  36. #ifdef HAVE_NETINET_IN_H
  37. # include <netinet/in.h>
  38. #endif
  39.  
  40. #ifdef HAVE_SYS_SOCKET_H
  41. #include <sys/socket.h>
  42. #endif
  43.  
  44. #ifdef HAVE_SYS_TIME_H
  45. #include <sys/time.h>
  46. #endif
  47.  
  48. struct php_sockbuf {
  49.     int socket;
  50.     unsigned char *readbuf;
  51.     size_t readbuflen;
  52.     size_t readpos;
  53.     size_t writepos;
  54.     struct php_sockbuf *next;
  55.     struct php_sockbuf *prev;
  56.     char eof;
  57.     char persistent;
  58.     char is_blocked;
  59.     size_t chunk_size;
  60.     struct timeval timeout;
  61.     char timeout_event;
  62. };
  63.  
  64. typedef struct php_sockbuf php_sockbuf;
  65.  
  66. PHP_FUNCTION(fsockopen);
  67. PHP_FUNCTION(pfsockopen);
  68.  
  69. int lookup_hostname(const char *addr, struct in_addr *in);
  70. char *php_sock_fgets(char *buf, size_t maxlen, int socket);
  71. size_t php_sock_fread(char *buf, size_t maxlen, int socket);
  72. int php_sock_feof(int socket);
  73. int php_sock_fgetc(int socket);
  74. int php_is_persistent_sock(int);
  75. int php_sockset_blocking(int socket, int mode);
  76. void php_sockset_timeout(int socket, struct timeval *timeout);
  77. int php_sockdestroy(int socket);
  78. int php_sock_close(int socket);
  79. size_t php_sock_set_def_chunk_size(size_t size);
  80. void php_msock_destroy(int *data);
  81.  
  82. PHPAPI int connect_nonb(int sockfd, struct sockaddr *addr, socklen_t addrlen, struct timeval *timeout);
  83. PHPAPI struct php_sockbuf *php_get_socket(int socket);
  84.  
  85. PHP_MINIT_FUNCTION(fsock);
  86. PHP_MSHUTDOWN_FUNCTION(fsock);
  87. PHP_RSHUTDOWN_FUNCTION(fsock);
  88.  
  89. typedef struct {
  90.     HashTable ht_fsock_keys;
  91.     HashTable ht_fsock_socks;
  92.     struct php_sockbuf *phpsockbuf;
  93.     size_t def_chunk_size;
  94. } php_fsock_globals;
  95.  
  96. #ifdef ZTS
  97. #define FLS_D php_fsock_globals *fsock_globals
  98. #define FLS_DC , FLS_D
  99. #define FLS_C fsock_globals
  100. #define FLS_CC , FLS_C
  101. #define FG(v) (fsock_globals->v)
  102. #define FLS_FETCH() php_fsock_globals *fsock_globals = ts_resource(fsock_globals_id)
  103. #else
  104. #define FLS_D    void
  105. #define FLS_DC
  106. #define FLS_C
  107. #define FLS_CC
  108. #define FG(v) (fsock_globals.v)
  109. #define FLS_FETCH()
  110. #endif
  111.  
  112. #endif /* FSOCK_H */
  113.